package com.xiaocikuai.smallchunks.service.Product.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xiaocikuai.smallchunks.entity.Product.LinkCustom;
import com.xiaocikuai.smallchunks.mapper.Product.LinkCustomMapper;
import com.xiaocikuai.smallchunks.service.Product.ILinkCustomService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 外部链接获取 服务实现类
 * </p>
 *
 * @author author1
 * @since 2024-07-18
 */
@Service
public class LinkCustomServiceImpl extends ServiceImpl<LinkCustomMapper, LinkCustom> implements ILinkCustomService {
    @Resource
    private LinkCustomMapper linkCustomMapper;

    public List<List<LinkCustom>> selectGroup(){
        List<List<LinkCustom>> info = new ArrayList<>();
        Set<Integer> list  = linkCustomMapper.getGroupId();

        for (int id : list){
            LambdaQueryWrapper<LinkCustom> lambdaQueryWrapper = new LambdaQueryWrapper<>();
            lambdaQueryWrapper.eq(LinkCustom::getGroups, id);
            List<LinkCustom> linkCustoms = linkCustomMapper.selectList(lambdaQueryWrapper);
            info.add(linkCustoms);
        }
        return info;
    }










}
